<template>
  <div>
    <MyHeader bgcolor="green" title="老王的小卖部"></MyHeader>
    <div class="main">
      <keep-alive> <component :is="isSon"></component></keep-alive>
    </div>
    <MyTabBar :tabs="tabList" @changefn="changefn"></MyTabBar>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader";
import MyTabBar from "./components/MyTabBar";
import MyGoodsList from "./views/MyGoodsList";
import UserInfo from "./views/MyUserInfo";
import GoodsSearch from "./views/MyGoodsSearch";
export default {
  components: {
    MyHeader,
    MyTabBar,
    MyGoodsList,
    UserInfo,
    GoodsSearch,
  },
  data() {
    return {
      isSon: "MyGoodsList",
      tabList: [
        {
          icon: "icon-shangpinliebiao",
          text: "商品列表",
          name: "MyGoodsList",
        },
        {
          icon: "icon-sousuo",
          text: "商品搜索",
          name: "GoodsSearch",
        },
        {
          icon: "icon-user",
          text: "我的信息",
          name: "UserInfo",
        },
      ],
    };
  },
  methods: {
    // 点击切换页面功能
    changefn(ind) {
      this.isSon = this.tabList[ind].name;
    },
  },
};
</script>

<style scoped>
.main {
  padding: 45px 0 50px 0;
}
</style>